<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Mathematical Functions and Operators</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.1.2 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Functions and Operators"
HREF="functions.html"><LINK
REL="PREVIOUS"
TITLE="Comparison Operators"
HREF="functions-comparison.html"><LINK
REL="NEXT"
TITLE="String Functions and Operators"
HREF="functions-string.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2011-12-01T22:07:59"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
><A
HREF="index.html"
>PostgreSQL 9.1.2 Documentation</A
></TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
TITLE="Comparison Operators"
HREF="functions-comparison.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="functions.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
>Chapter 9. Functions and Operators</TD
><TD
WIDTH="20%"
ALIGN="right"
VALIGN="top"
><A
TITLE="String Functions and Operators"
HREF="functions-string.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="FUNCTIONS-MATH"
>9.3. Mathematical Functions and Operators</A
></H1
><P
>    Mathematical operators are provided for many
    <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> types. For types without
    standard mathematical conventions
    (e.g., date/time types) we
    describe the actual behavior in subsequent sections.
   </P
><P
>    <A
HREF="functions-math.html#FUNCTIONS-MATH-OP-TABLE"
>Table 9-2</A
> shows the available mathematical operators.
   </P
><DIV
CLASS="TABLE"
><A
NAME="FUNCTIONS-MATH-OP-TABLE"
></A
><P
><B
>Table 9-2. Mathematical Operators</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><COL><THEAD
><TR
><TH
>Operator</TH
><TH
>Description</TH
><TH
>Example</TH
><TH
>Result</TH
></TR
></THEAD
><TBODY
><TR
><TD
> <TT
CLASS="LITERAL"
>+</TT
> </TD
><TD
>addition</TD
><TD
><TT
CLASS="LITERAL"
>2 + 3</TT
></TD
><TD
><TT
CLASS="LITERAL"
>5</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>-</TT
> </TD
><TD
>subtraction</TD
><TD
><TT
CLASS="LITERAL"
>2 - 3</TT
></TD
><TD
><TT
CLASS="LITERAL"
>-1</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>*</TT
> </TD
><TD
>multiplication</TD
><TD
><TT
CLASS="LITERAL"
>2 * 3</TT
></TD
><TD
><TT
CLASS="LITERAL"
>6</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>/</TT
> </TD
><TD
>division (integer division truncates the result)</TD
><TD
><TT
CLASS="LITERAL"
>4 / 2</TT
></TD
><TD
><TT
CLASS="LITERAL"
>2</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>%</TT
> </TD
><TD
>modulo (remainder)</TD
><TD
><TT
CLASS="LITERAL"
>5 % 4</TT
></TD
><TD
><TT
CLASS="LITERAL"
>1</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>^</TT
> </TD
><TD
>exponentiation</TD
><TD
><TT
CLASS="LITERAL"
>2.0 ^ 3.0</TT
></TD
><TD
><TT
CLASS="LITERAL"
>8</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>|/</TT
> </TD
><TD
>square root</TD
><TD
><TT
CLASS="LITERAL"
>|/ 25.0</TT
></TD
><TD
><TT
CLASS="LITERAL"
>5</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>||/</TT
> </TD
><TD
>cube root</TD
><TD
><TT
CLASS="LITERAL"
>||/ 27.0</TT
></TD
><TD
><TT
CLASS="LITERAL"
>3</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>!</TT
> </TD
><TD
>factorial</TD
><TD
><TT
CLASS="LITERAL"
>5 !</TT
></TD
><TD
><TT
CLASS="LITERAL"
>120</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>!!</TT
> </TD
><TD
>factorial (prefix operator)</TD
><TD
><TT
CLASS="LITERAL"
>!! 5</TT
></TD
><TD
><TT
CLASS="LITERAL"
>120</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>@</TT
> </TD
><TD
>absolute value</TD
><TD
><TT
CLASS="LITERAL"
>@ -5.0</TT
></TD
><TD
><TT
CLASS="LITERAL"
>5</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>&amp;</TT
> </TD
><TD
>bitwise AND</TD
><TD
><TT
CLASS="LITERAL"
>91 &amp; 15</TT
></TD
><TD
><TT
CLASS="LITERAL"
>11</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>|</TT
> </TD
><TD
>bitwise OR</TD
><TD
><TT
CLASS="LITERAL"
>32 | 3</TT
></TD
><TD
><TT
CLASS="LITERAL"
>35</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>#</TT
> </TD
><TD
>bitwise XOR</TD
><TD
><TT
CLASS="LITERAL"
>17 # 5</TT
></TD
><TD
><TT
CLASS="LITERAL"
>20</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>~</TT
> </TD
><TD
>bitwise NOT</TD
><TD
><TT
CLASS="LITERAL"
>~1</TT
></TD
><TD
><TT
CLASS="LITERAL"
>-2</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>&lt;&lt;</TT
> </TD
><TD
>bitwise shift left</TD
><TD
><TT
CLASS="LITERAL"
>1 &lt;&lt; 4</TT
></TD
><TD
><TT
CLASS="LITERAL"
>16</TT
></TD
></TR
><TR
><TD
> <TT
CLASS="LITERAL"
>&gt;&gt;</TT
> </TD
><TD
>bitwise shift right</TD
><TD
><TT
CLASS="LITERAL"
>8 &gt;&gt; 2</TT
></TD
><TD
><TT
CLASS="LITERAL"
>2</TT
></TD
></TR
></TBODY
></TABLE
></DIV
><P
>    The bitwise operators work only on integral data types, whereas
    the others are available for all numeric data types.  The bitwise
    operators are also available for the bit
    string types <TT
CLASS="TYPE"
>bit</TT
> and <TT
CLASS="TYPE"
>bit varying</TT
>, as
    shown in <A
HREF="functions-bitstring.html#FUNCTIONS-BIT-STRING-OP-TABLE"
>Table 9-10</A
>.
   </P
><P
>   <A
HREF="functions-math.html#FUNCTIONS-MATH-FUNC-TABLE"
>Table 9-3</A
> shows the available
   mathematical functions.  In the table, <TT
CLASS="LITERAL"
>dp</TT
>
   indicates <TT
CLASS="TYPE"
>double precision</TT
>.  Many of these functions
   are provided in multiple forms with different argument types.
   Except where noted, any given form of a function returns the same
   data type as its argument.
   The functions working with <TT
CLASS="TYPE"
>double precision</TT
> data are mostly
   implemented on top of the host system's C library; accuracy and behavior in
   boundary cases can therefore vary depending on the host system.
  </P
><DIV
CLASS="TABLE"
><A
NAME="FUNCTIONS-MATH-FUNC-TABLE"
></A
><P
><B
>Table 9-3. Mathematical Functions</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><COL><COL><THEAD
><TR
><TH
>Function</TH
><TH
>Return Type</TH
><TH
>Description</TH
><TH
>Example</TH
><TH
>Result</TH
></TR
></THEAD
><TBODY
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>abs(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>absolute value</TD
><TD
><TT
CLASS="LITERAL"
>abs(-17.4)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>17.4</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>cbrt(<TT
CLASS="TYPE"
>dp</TT
>)</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>dp</TT
></TD
><TD
>cube root</TD
><TD
><TT
CLASS="LITERAL"
>cbrt(27.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>3</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>ceil(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>smallest integer not less than argument</TD
><TD
><TT
CLASS="LITERAL"
>ceil(-42.8)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>-42</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>ceiling(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>smallest integer not less than argument (alias for <CODE
CLASS="FUNCTION"
>ceil</CODE
>)</TD
><TD
><TT
CLASS="LITERAL"
>ceiling(-95.3)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>-95</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>degrees(<TT
CLASS="TYPE"
>dp</TT
>)</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>dp</TT
></TD
><TD
>radians to degrees</TD
><TD
><TT
CLASS="LITERAL"
>degrees(0.5)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>28.6478897565412</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>div(<TT
CLASS="PARAMETER"
>y</TT
> <TT
CLASS="TYPE"
>numeric</TT
>,
         <TT
CLASS="PARAMETER"
>x</TT
> <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>numeric</TT
></TD
><TD
>integer quotient of <TT
CLASS="PARAMETER"
>y</TT
>/<TT
CLASS="PARAMETER"
>x</TT
></TD
><TD
><TT
CLASS="LITERAL"
>div(9,4)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>2</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>exp(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>exponential</TD
><TD
><TT
CLASS="LITERAL"
>exp(1.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>2.71828182845905</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>floor(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>largest integer not greater than argument</TD
><TD
><TT
CLASS="LITERAL"
>floor(-42.8)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>-43</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>ln(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>natural logarithm</TD
><TD
><TT
CLASS="LITERAL"
>ln(2.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>0.693147180559945</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>log(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>base 10 logarithm</TD
><TD
><TT
CLASS="LITERAL"
>log(100.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>2</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>log(<TT
CLASS="PARAMETER"
>b</TT
> <TT
CLASS="TYPE"
>numeric</TT
>,
        <TT
CLASS="PARAMETER"
>x</TT
> <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
></TD
><TD
><TT
CLASS="TYPE"
>numeric</TT
></TD
><TD
>logarithm to base <TT
CLASS="PARAMETER"
>b</TT
></TD
><TD
><TT
CLASS="LITERAL"
>log(2.0, 64.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>6.0000000000</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>mod(<TT
CLASS="PARAMETER"
>y</TT
>,
         <TT
CLASS="PARAMETER"
>x</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as argument types)</TD
><TD
>remainder of <TT
CLASS="PARAMETER"
>y</TT
>/<TT
CLASS="PARAMETER"
>x</TT
></TD
><TD
><TT
CLASS="LITERAL"
>mod(9,4)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>1</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>pi()</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>dp</TT
></TD
><TD
><SPAN
CLASS="QUOTE"
>"&pi;"</SPAN
> constant</TD
><TD
><TT
CLASS="LITERAL"
>pi()</TT
></TD
><TD
><TT
CLASS="LITERAL"
>3.14159265358979</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>power(<TT
CLASS="PARAMETER"
>a</TT
> <TT
CLASS="TYPE"
>dp</TT
>,
        <TT
CLASS="PARAMETER"
>b</TT
> <TT
CLASS="TYPE"
>dp</TT
>)</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>dp</TT
></TD
><TD
><TT
CLASS="PARAMETER"
>a</TT
> raised to the power of <TT
CLASS="PARAMETER"
>b</TT
></TD
><TD
><TT
CLASS="LITERAL"
>power(9.0, 3.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>729</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>power(<TT
CLASS="PARAMETER"
>a</TT
> <TT
CLASS="TYPE"
>numeric</TT
>,
        <TT
CLASS="PARAMETER"
>b</TT
> <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
></TD
><TD
><TT
CLASS="TYPE"
>numeric</TT
></TD
><TD
><TT
CLASS="PARAMETER"
>a</TT
> raised to the power of <TT
CLASS="PARAMETER"
>b</TT
></TD
><TD
><TT
CLASS="LITERAL"
>power(9.0, 3.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>729</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>radians(<TT
CLASS="TYPE"
>dp</TT
>)</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>dp</TT
></TD
><TD
>degrees to radians</TD
><TD
><TT
CLASS="LITERAL"
>radians(45.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>0.785398163397448</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>random()</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>dp</TT
></TD
><TD
>random value in the range 0.0 &lt;= x &lt; 1.0</TD
><TD
><TT
CLASS="LITERAL"
>random()</TT
></TD
><TD
>&nbsp;</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>round(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>round to nearest integer</TD
><TD
><TT
CLASS="LITERAL"
>round(42.4)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>42</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>round(<TT
CLASS="PARAMETER"
>v</TT
> <TT
CLASS="TYPE"
>numeric</TT
>, <TT
CLASS="PARAMETER"
>s</TT
> <TT
CLASS="TYPE"
>int</TT
>)</CODE
></TT
></TD
><TD
><TT
CLASS="TYPE"
>numeric</TT
></TD
><TD
>round to <TT
CLASS="PARAMETER"
>s</TT
> decimal places</TD
><TD
><TT
CLASS="LITERAL"
>round(42.4382, 2)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>42.44</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>setseed(<TT
CLASS="TYPE"
>dp</TT
>)</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>void</TT
></TD
><TD
>set seed for subsequent <TT
CLASS="LITERAL"
>random()</TT
> calls (value between -1.0 and
       1.0, inclusive)</TD
><TD
><TT
CLASS="LITERAL"
>setseed(0.54823)</TT
></TD
><TD
>&nbsp;</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>sign(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>sign of the argument (-1, 0, +1)</TD
><TD
><TT
CLASS="LITERAL"
>sign(-8.4)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>-1</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>sqrt(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>square root</TD
><TD
><TT
CLASS="LITERAL"
>sqrt(2.0)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>1.4142135623731</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>trunc(<TT
CLASS="TYPE"
>dp</TT
> or <TT
CLASS="TYPE"
>numeric</TT
>)</CODE
></TT
>
       </TD
><TD
>(same as input)</TD
><TD
>truncate toward zero</TD
><TD
><TT
CLASS="LITERAL"
>trunc(42.8)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>42</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>trunc(<TT
CLASS="PARAMETER"
>v</TT
> <TT
CLASS="TYPE"
>numeric</TT
>, <TT
CLASS="PARAMETER"
>s</TT
> <TT
CLASS="TYPE"
>int</TT
>)</CODE
></TT
></TD
><TD
><TT
CLASS="TYPE"
>numeric</TT
></TD
><TD
>truncate to <TT
CLASS="PARAMETER"
>s</TT
> decimal places</TD
><TD
><TT
CLASS="LITERAL"
>trunc(42.4382, 2)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>42.43</TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>width_bucket(<TT
CLASS="PARAMETER"
>op</TT
> <TT
CLASS="TYPE"
>numeric</TT
>, <TT
CLASS="PARAMETER"
>b1</TT
> <TT
CLASS="TYPE"
>numeric</TT
>, <TT
CLASS="PARAMETER"
>b2</TT
> <TT
CLASS="TYPE"
>numeric</TT
>, <TT
CLASS="PARAMETER"
>count</TT
> <TT
CLASS="TYPE"
>int</TT
>)</CODE
></TT
>
       </TD
><TD
><TT
CLASS="TYPE"
>int</TT
></TD
><TD
>return the bucket to which <TT
CLASS="PARAMETER"
>operand</TT
> would
       be assigned in an equidepth histogram with <TT
CLASS="PARAMETER"
>count</TT
>
       buckets, in the range <TT
CLASS="PARAMETER"
>b1</TT
> to <TT
CLASS="PARAMETER"
>b2</TT
></TD
><TD
><TT
CLASS="LITERAL"
>width_bucket(5.35, 0.024, 10.06, 5)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>3</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>width_bucket(<TT
CLASS="PARAMETER"
>op</TT
> <TT
CLASS="TYPE"
>dp</TT
>, <TT
CLASS="PARAMETER"
>b1</TT
> <TT
CLASS="TYPE"
>dp</TT
>, <TT
CLASS="PARAMETER"
>b2</TT
> <TT
CLASS="TYPE"
>dp</TT
>, <TT
CLASS="PARAMETER"
>count</TT
> <TT
CLASS="TYPE"
>int</TT
>)</CODE
></TT
></TD
><TD
><TT
CLASS="TYPE"
>int</TT
></TD
><TD
>return the bucket to which <TT
CLASS="PARAMETER"
>operand</TT
> would
       be assigned in an equidepth histogram with <TT
CLASS="PARAMETER"
>count</TT
>
       buckets, in the range <TT
CLASS="PARAMETER"
>b1</TT
> to <TT
CLASS="PARAMETER"
>b2</TT
></TD
><TD
><TT
CLASS="LITERAL"
>width_bucket(5.35, 0.024, 10.06, 5)</TT
></TD
><TD
><TT
CLASS="LITERAL"
>3</TT
></TD
></TR
></TBODY
></TABLE
></DIV
><P
>   Finally, <A
HREF="functions-math.html#FUNCTIONS-MATH-TRIG-TABLE"
>Table 9-4</A
> shows the
   available trigonometric functions.  All trigonometric functions
   take arguments and return values of type <TT
CLASS="TYPE"
>double
   precision</TT
>. Trigonometric functions arguments are expressed
   in radians. Inverse functions return values are expressed in
   radians.  See unit transformation functions
   <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>radians()</CODE
></TT
> and
   <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>degrees()</CODE
></TT
> above.
  </P
><DIV
CLASS="TABLE"
><A
NAME="FUNCTIONS-MATH-TRIG-TABLE"
></A
><P
><B
>Table 9-4. Trigonometric Functions</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><THEAD
><TR
><TH
>Function</TH
><TH
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>acos(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>inverse cosine</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>asin(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>inverse sine</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>atan(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>inverse tangent</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>atan2(<TT
CLASS="REPLACEABLE"
><I
>y</I
></TT
>,
        <TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>inverse tangent of
        <TT
CLASS="LITERAL"
><TT
CLASS="REPLACEABLE"
><I
>y</I
></TT
>/<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
></TT
></TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>cos(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>cosine</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>cot(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>cotangent</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>sin(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>sine</TD
></TR
><TR
><TD
>        
        <TT
CLASS="LITERAL"
><CODE
CLASS="FUNCTION"
>tan(<TT
CLASS="REPLACEABLE"
><I
>x</I
></TT
>)</CODE
></TT
>
       </TD
><TD
>tangent</TD
></TR
></TBODY
></TABLE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="functions-comparison.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="functions-string.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Comparison Operators</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="functions.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>String Functions and Operators</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>